﻿CREATE PROCEDURE [dbo].[proc_Finance_RunningAccount_DeleteeOrderRecord]
	(
		@OrderId nvarchar(50),
		@PayId int
	)
AS
begin
	Update [Order] Set 
		StateId=2,
		ShiShouPrice=(Select Sum(Prices) From Order_PaymentRecord Where OId=[Order].OId and FinanceFlag=1),
		FinanceRenlingDate=GetDate()
	Where OId=@OrderId 
	
	Delete From Order_PaymentRecord Where Id=@PayId
end
	RETURN
